package com.atguigu.jxc.service.impl;

import com.atguigu.jxc.dao.GoodsAllUnitDao;
import com.atguigu.jxc.entity.Goods;
import com.atguigu.jxc.entity.Log;
import com.atguigu.jxc.entity.Unit;
import com.atguigu.jxc.service.GoodsAllUnitService;
import com.atguigu.jxc.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class GoodsAllUnitServiceImpl implements GoodsAllUnitService {
    @Autowired
    GoodsAllUnitDao goodsAllUnitDao;
    @Autowired
    LogService logService;

    //查询所有商品单位
    @Override
    public Map<String, Object> getGoodsAllUnit() {
        Map<String,Object> map = new HashMap<>();
        List<Unit> units = goodsAllUnitDao.getGoodsAllUnit();

        logService.save(new Log(Log.SELECT_ACTION,"查询商品单位信息"));

        map.put("rows", units);

        return map;
    }
}
